﻿<!--#include file="conn.asp"-->
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>批量生成HTML</title>
    <style>
        body
        {
            font-size: 9pt;
            line-height: 140%;
        }
    </style>
</head>
<body>
    <%
set rs=server.createobject("adodb.recordset")
set rsm=server.createobject("adodb.recordset")
id=request("id")
rs.open "select * from ad where id="&request("id"),conn,1,1
     if not rs.eof then
	 id=rs("id")
	 adfilename=rs("adfilename")
       adcontent=rs("adcontent")
       adtitle=rs("adtitle")
   rs.close    

'Set fso = Server.CreateObject("Scripting.FileSystemObject")
'set fr=fso.opentextfile(server.mappath("TEMP/ad.htm"))
'pencat=fr.readall
'fr.close
pencat=ReadFromTextFile("TEMP/ad.htm","utf-8")

pencat=replace(pencat,"[ADTITLE]",adtitle)
pencat=replace(pencat,"[ADCONTENT]",adcontent)

'Set fout = fso.CreateTextFile(server.mappath("../ad/"&adfilename&""))
'fout.Write pencat
'fout.close
WriteToTextFile "../ad/"&adfilename&"",pencat,"utf-8"

if request("type")="page" then%><font color="#FF0000">生成页面完成</font><script language="JavaScript">
<!--
                                                                       setTimeout('window.close();', 500);
// -->
</script>
    <%end if%><%end if%>
</body>
</html>
